﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="User_Create.aspx.cs" Inherits="SYS_POPEDOM_User_Create" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>用户编辑</title>
    <link href="../css/PageStyle.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../JavaScript/Common.js"></script>
    <script type="text/javascript">

        function nodeLoadWin(node) {
            Ext.net.DirectMethods.NodeLoadWin(node.id, {
                success: function(result) {
                    var data = eval("(" + result + ")");
                    node.loadNodes(data);
                },
                failure: function(errorMsg) {
                    Ext.Msg.alert('Failure', errorMsg);
                }
            });
        }

        function refreshTree(tree) {
            tree.root.ui.remove();
            tree.root.render();
            Ext.net.DirectMethods.RefreshMenu({
                success: function(result) {
                    var nodes = eval(result);
                    tree.initChildren(nodes);
                    tree.root.render();
                }
            });
        }
        function ClostWin() {
            popWindow.hide();
        }

        function getCheckedNode() {
            var result = "";
            var checkeds = Ext.getCmp('TreePanel1').getChecked();
            for (var i = 0; i < checkeds.length; i++) {
                result = result + checkeds[i].id + ";";
            }
            result = result.substring(0, result.length - 1)
            return result;
        }

        function SaveWin() {
            var seResult = getCheckedNode();
            if (seResult != "") {
                extHid_SelectedRole.value = seResult;
                popWindow.hide();
                extBtn_AddMenu.fireEvent("click", "");
            }
            else {
                Ext.Msg.alert('系统提示', "请选择角色!");
                return;
            }
        }


        function DelFunc() {
            if (!GridPanel1.hasSelection()) {
                Ext.Msg.alert("系统提示", "请选择要删除的记录!");
                return;
            }

            var records = GridPanel1.getSelectionModel().getSelections();
            var recordData = [];
            Ext.each(records, function(record) {
                recordData.push(record.data);
            });
            var jsonData = Ext.encode(recordData);

            Ext.MessageBox.confirm(
                "系统提示",
                "确定删除吗？",
                function(btn, text) {
                    if (btn === "yes") {
                        Ext.net.DirectMethods.DelFunc(jsonData);
                    }
                },
                this
            );
        }
    </script>

</head>
<body class="backcolor">
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" AjaxViewStateMode="Enabled" />
    <ext:Store ID="Store1" runat="server" AutoLoad="true">
        <Reader>
            <ext:JsonReader IDProperty="MASTER_ID">
                <Fields>
                    <ext:RecordField Name="MASTER_ID" />
                    <ext:RecordField Name="ROLE_NAME" />
                    <ext:RecordField Name="DEPT_NAME" />
                    <ext:RecordField Name="DEPT_ID" />
                    <ext:RecordField Name="CREATOR" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Toolbar ID="Toolbar3" runat="server">
        <Items>
            <ext:Button ID="extBtn_Save" runat="server" Text=" 保存" Icon="Accept">
                <DirectEvents>
                    <Click OnEvent="extBtn_SaveClick">
                        <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="Viewport1" />
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:Button ID="extBtn_Cancel" runat="server" Text="关闭" Icon="Cancel">
                <Listeners>
                    <Click Fn="closeCurrTab" />
                </Listeners>
            </ext:Button>
        </Items>
    </ext:Toolbar>
    <ext:Viewport ID="Viewport1" runat="server">
        <Content>
            <ext:RowLayout ID="RowLayout2" runat="server">
                <Rows>
                    <ext:LayoutRow>
                        <ext:FormPanel ID="Panel2" runat="server" Title="操作员信息" Height="240" Border="false"
                            Layout="Fit" BodyStyle="border-width:0 0 1px 0;top:10px; ">
                            <Content>
                                <ext:RowLayout ID="RowLayout7" runat="server">
                                    <Rows>
                                        <ext:LayoutRow>
                                            <ext:Panel ID="Panel4" runat="server" Title="" Border="false" BodyBorder="false"
                                                Layout="Fit" Height="135">
                                                <Content>
                                                    <ext:ColumnLayout ID="ColumnLayout1" runat="server">
                                                        <Columns>
                                                            <ext:LayoutColumn ColumnWidth="0.33">
                                                                <ext:Panel ID="Panel33" runat="server" Border="false" Height="140">
                                                                    <Content>
                                                                        <ext:FormLayout ID="FormLayout3" runat="server">
                                                                            <Anchors>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_user_id" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel="操作员编号">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:DropDownField ID="extcobo_DeptName" runat="server" LabelStyle=" text-align:right; "
                                                                                        FieldLabel="所属部门" Editable="false" ForceSelection="false" AllowBlank="true">
                                                                                        <Component>
                                                                                            <ext:TreePanel ID="TreePanel2" runat="server" Height="300" StyleSpec="width:100%"
                                                                                                AutoScroll="true" AutoRender="false" Icon="Foldergo" RootVisible="false">
                                                                                                <Loader>
                                                                                                    <ext:PageTreeLoader OnNodeLoad="DeptNodeLoad" PreloadChildren="true" />
                                                                                                </Loader>
                                                                                                <Root>
                                                                                                    <ext:AsyncTreeNode NodeID="0" Text="请选择树节点" Icon="ArrowRight" />
                                                                                                </Root>
                                                                                                <Listeners>
                                                                                                    <Click Handler="#{extcobo_DeptName}.setValue(node.text);#{extHid_coboDeptId}.setValue(node.id);#{extcobo_DeptName}.collapse();" />
                                                                                                    <ExpandNode Handler=" if(node.id=='0') node.childNodes[0].select(); else node.select();" />
                                                                                                </Listeners>
                                                                                            </ext:TreePanel>
                                                                                        </Component>
                                                                                    </ext:DropDownField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_CONTACT_PHONE" LabelStyle=" text-align:right; " FieldLabel="移动电话"
                                                                                        runat="server">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_HOME_PHONE" LabelStyle=" text-align:right; " FieldLabel="家庭电话"
                                                                                        runat="server">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_USER_DUTY" LabelStyle=" text-align:right; " FieldLabel="职务岗位"
                                                                                        runat="server">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TriggerField ID="exttrig_OTHER_USER1" LabelStyle=" text-align:right; " FieldLabel="系统（1）ID"
                                                                                        runat="server" Visible="false">
                                                                                        <DirectEvents>
                                                                                            <TriggerClick OnEvent="OnExttrig_OTHER_USER1_Click">
                                                                                            </TriggerClick>
                                                                                        </DirectEvents>
                                                                                    </ext:TriggerField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_OTHER_PWD1" LabelStyle=" text-align:right; " FieldLabel="系统（1）密码"
                                                                                        runat="server" InputType="Password" Visible="false">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                            </Anchors>
                                                                        </ext:FormLayout>
                                                                        <ext:Hidden ID="extHid_coboDeptId" runat="server" Text="">
                                                                        </ext:Hidden>
                                                                    </Content>
                                                                </ext:Panel>
                                                            </ext:LayoutColumn>
                                                            <ext:LayoutColumn ColumnWidth="0.33">
                                                                <ext:Panel ID="Panel32" runat="server" Border="false">
                                                                    <Content>
                                                                        <ext:FormLayout ID="FormLayout2" runat="server">
                                                                            <Anchors>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_USER_NAME" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel="操作员名称">
                                                                                        <DirectEvents>
                                                                                            <Blur OnEvent="GetPY">
                                                                                            </Blur>
                                                                                        </DirectEvents>
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:RadioGroup ID="RadioGroup1" runat="server" LabelStyle=" text-align:right; "
                                                                                        FieldLabel="是否有个人库房">
                                                                                        <Items>
                                                                                            <ext:Radio ID="rdoIS_MANAGER1" runat="server" BoxLabel="是" />
                                                                                            <ext:Radio ID="rdoIS_MANAGER2" runat="server" BoxLabel="否" Checked="true" />
                                                                                        </Items>
                                                                                    </ext:RadioGroup>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_INNER_PHONE" runat="server" LabelStyle=" text-align:right; "
                                                                                        FieldLabel="内部电话">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_E_MAIL" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel=" E_mail">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_ADDRESS" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel="住址">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                            </Anchors>
                                                                        </ext:FormLayout>
                                                                    </Content>
                                                                </ext:Panel>
                                                            </ext:LayoutColumn>
                                                            <ext:LayoutColumn ColumnWidth="0.33">
                                                                <ext:Panel ID="Panel34" runat="server" Border="false">
                                                                    <Content>
                                                                        <ext:FormLayout ID="FormLayout4" runat="server">
                                                                            <Anchors>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_USER_PYM" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel="拼音码">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_USER_PASSWORD" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel="登陆密码" InputType="Password">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_DISPLAY_ORDER" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel="排序号">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                                <ext:Anchor Horizontal="95%">
                                                                                    <ext:TextField ID="exttxtf_OFFICE_PHONE" LabelStyle=" text-align:right; " runat="server"
                                                                                        FieldLabel="办公电话">
                                                                                    </ext:TextField>
                                                                                </ext:Anchor>
                                                                            </Anchors>
                                                                        </ext:FormLayout>
                                                                    </Content>
                                                                </ext:Panel>
                                                            </ext:LayoutColumn>
                                                        </Columns>
                                                    </ext:ColumnLayout>
                                                </Content>
                                            </ext:Panel>
                                        </ext:LayoutRow>
                                        <ext:LayoutRow>
                                            <ext:Panel ID="Panel55" runat="server" Border="false" Height="60">
                                                <Content>
                                                    <ext:FormLayout ID="FormLayout15" runat="server">
                                                        <Anchors>
                                                            <ext:Anchor Horizontal="98%">
                                                                <ext:TextArea ID="exttare_REMARK" LabelStyle=" text-align:right; " runat="server"
                                                                    FieldLabel="备注" Height="50" />
                                                            </ext:Anchor>
                                                        </Anchors>
                                                    </ext:FormLayout>
                                                </Content>
                                            </ext:Panel>
                                        </ext:LayoutRow>
                                    </Rows>
                                </ext:RowLayout>
                            </Content>
                        </ext:FormPanel>
                    </ext:LayoutRow>
                    <ext:LayoutRow RowHeight="1">
                        <ext:Panel runat="server" ID="ddd" BodyStyle="border-width:1px 0 0 0;">
                            <Content>
                                <ext:FitLayout runat="server">
                                    <Items>
                                        <ext:Panel ID="Panel3" runat="server" Title="" Cls="tool-form" Border="false">
                                            <TopBar>
                                                <ext:Toolbar ID="Toolbar1" runat="server">
                                                    <Items>
                                                        <ext:Label ID="t" runat="server" Text="操作员拥有角色" />
                                                        <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                                                        <ext:Button ID="extBtn_Add" runat="server" Text=" 增加" Icon="Add">
                                                            <Listeners>
                                                                <Click Handler="#{GridPanel1}.save();refreshTree(#{TreePanel1});#{popWindow}.show();" />
                                                            </Listeners>
                                                        </ext:Button>
                                                        <ext:Button ID="extBtn_Del" runat="server" Text="删除" Icon="Delete">
                                                            <Listeners>
                                                                <Click Fn="DelFunc" />
                                                            </Listeners>
                                                        </ext:Button>
                                                    </Items>
                                                </ext:Toolbar>
                                            </TopBar>
                                            <Content>
                                                <ext:FitLayout ID="FitLayout2" runat="server">
                                                    <Items>
                                                        <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" Border="false" AutoWidth="true"
                                                            AutoShow="true" AutoExpandColumn="MASTER_ID">
                                                            <ColumnModel runat="server">
                                                                <Columns>
                                                                    <ext:RowNumbererColumn Header="序号" Width="35" />
                                                                    <ext:Column ColumnID="MASTER_ID" Css="" Header="<center>角色主键</center>" Sortable="true"
                                                                        DataIndex="MASTER_ID" Width="100" Hidden="true">
                                                                    </ext:Column>
                                                                    <ext:Column ColumnID="DEPT_ID" DataIndex="DEPT_ID" Hidden="true" />
                                                                    <ext:Column ColumnID="CREATOR" DataIndex="CREATOR" Hidden="true" />
                                                                    <ext:Column Header="<center>角色名称</center>" Sortable="true" DataIndex="ROLE_NAME"
                                                                        Width="200">
                                                                    </ext:Column>
                                                                    <ext:Column Header="<center>部门名称</center>" Sortable="true" DataIndex="DEPT_NAME"
                                                                        Width="200">
                                                                    </ext:Column>
                                                                </Columns>
                                                            </ColumnModel>
                                                            <SelectionModel>
                                                                <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" ColumnPosition="1"
                                                                    Width="20" AllowDeselect="true">
                                                                </ext:CheckboxSelectionModel>
                                                            </SelectionModel>
                                                            <LoadMask />
                                                        </ext:GridPanel>
                                                    </Items>
                                                </ext:FitLayout>
                                            </Content>
                                        </ext:Panel>
                                    </Items>
                                </ext:FitLayout>
                            </Content>
                        </ext:Panel>
                    </ext:LayoutRow>
                </Rows>
            </ext:RowLayout>
            <ext:Window ID="popWindow" runat="server" Icon="Group" Title="选择角色" Width="400" Height="380"
                AutoShow="false" Modal="true" ShowOnLoad="false" Closable="true" Resizable="true"
                Hidden="true" Draggable="false">
                <Content>
                    <ext:Panel ID="Panel1" runat="server" Border="false" Height="320">
                        <Content>
                            <ext:FitLayout ID="FitLayout1" runat="server">
                                <Items>
                                    <ext:TreePanel ID="TreePanel1" runat="server" Lines="true" Border="false" CollapseFirst="false"
                                        AutoScroll="true" ContainerScroll="true">
                                        <Listeners>
                                            <BeforeLoad Fn="nodeLoadWin" />
                                        </Listeners>
                                        <LoadMask ShowMask="true" />
                                    </ext:TreePanel>
                                </Items>
                            </ext:FitLayout>
                        </Content>
                    </ext:Panel>
                </Content>
                <TopBar>
                    <ext:Toolbar ID="Toolbar2" runat="server">
                        <Items>
                            <ext:Button ID="btnSave" runat="server" Text="确定" Icon="Disk">
                                <Listeners>
                                    <Click Fn="SaveWin" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="btnCancel" runat="server" Text="关闭" Icon="Cancel">
                                <Listeners>
                                    <Click Fn="ClostWin" />
                                </Listeners>
                            </ext:Button>
                            <ext:ToolbarFill ID="ToolbarFill2" runat="server">
                            </ext:ToolbarFill>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
            </ext:Window>
            <ext:Hidden ID="extHid_SelectedRole" runat="server" Text="">
            </ext:Hidden>
            <ext:Button ID="extBtn_AddMenu" runat="server" Hidden="true">
                <Listeners>
                    <Click Handler="Ext.net.DirectMethods.refrashDataEvent(#{extHid_SelectedRole}.value);" />
                </Listeners>
            </ext:Button>
        </Content>
    </ext:Viewport>
    </form>
</body>
</html>
